$import( "SmitearWebGL.Programs.AbstractProgram" );

SmitearWebGL.Programs.LightPrePass.ShadowProgram = SmitearWebGL.Programs.AbstractProgram.extend(
{
	/******** constructor ********/
	
	init : function()
	{
		this._super();
		this._registClass( "SmitearWebGL.Programs.LightPrePass.ShadowProgram" );
	}
	,
	
	/******** public method ********/
	
	activeUniform : function( renderableObject )
	{
		this.context.gl.uniform4fv( this._shader.uniforms.uShadowColor.location, new Float32Array( SmitearWebGL.Objects.Canvas.LightPrePass.Shadow.shadowColor.flatten() ) );
		
		return SmitearWebGL.Core.HResult.SUCCESS;
	}
	,
	
	/******** private method ********/
	
	_generateVertexShaderStr : function()
	{
		this._super();
		
		var vertStr =
		"\
		attribute vec3 " + SmitearWebGL.Resources.Buffer.AttribLocation.POSITION +";\n\
		void main(void)\n\
		{\n\
		vec4 pos = vec4(" + SmitearWebGL.Resources.Buffer.AttribLocation.POSITION +", 1.0);\n\
		gl_Position = pos;\n\
		}\n\
		";
		
		return vertStr;
	}
	,
	_generateFragmentShaderStr : function( renderableObject )
	{
		this._super();
		
		var fragStr = 
		"\
		#ifdef GL_ES\n\
		precision highp float;\n\
		#endif\n\
		uniform vec4 uShadowColor;\n\
		\n\
		void main(void)\n\
		{\n\
			gl_FragColor = uShadowColor;\n\
		}\n\
		";
		
		return fragStr;
	}
}
);